<script>
//图表X轴配置
import BaseConfig from '../BaseConfig';
import * as ConfigEnum from '../config/config-enum';

export default {
  name: 'YAxisConfig',
  mixins: [BaseConfig],
  data() {
    return {
      yAxisPos: ConfigEnum.YAXIS_POSITION,
      yAxisTitlePos: ConfigEnum.AXIS_TITLE_POSITION,
    };
  },
};
</script>

<template>
  <div>
    <Row>
      <Col span="10">
      <span>是否显示：</span>
      </Col>
      <Col span="14">
      <Switch
        v-model="chartOptions.extend.yAxis[0].show"
        @on-change="updateOptions">
        <span slot="open">是</span>
        <span slot="close">否</span>
      </Switch>
      </Col>
    </Row>
    <div
      v-if="chartOptions.extend.yAxis[0].show"
      class="switch-box">
      <Row>
        <Col span="10">
        <span>轴位置：</span>
        </Col>
        <Col span="14">
        <Select
          v-model="chartOptions.extend.yAxis[0].position"
          @on-change="updateOptions">
          <Option
            v-for="item in yAxisPos"
            :value="item.value"
            :key="item.value">{{ item.key }}</Option>
        </Select>
        </Col>
      </Row>
      <Row>
        <Col span="10">
        <span>轴标签旋转角度：</span>
        </Col>
        <Col span="14">
        <InputNumber
          v-model="chartOptions.extend.yAxis[0].axisLabel.rotate"
          @on-change="updateOptions"></InputNumber>
        </Col>
      </Row>
      <Row>
        <Col span="10">
        <span>轴标题：</span>
        </Col>
        <Col span="14">
        <Input
          v-model="chartOptions.extend.yAxis[0].name"
          @on-change="updateOptions"></Input>
        </Col>
      </Row>
      <Row>
        <Col span="10">
        <span>轴标题位置：</span>
        </Col>
        <Col span="14">
        <Select
          v-model="chartOptions.extend.yAxis[0].nameLocation"
          @on-change="updateOptions">
          <Option
            v-for="item in yAxisTitlePos"
            :value="item.value"
            :key="item.value">{{ item.key }}</Option>
        </Select>
        </Col>
      </Row>
    </div>
  </div>
</template>

<style>
</style>
